classdef ReliefF ...
        < Algorithm ...
        & Modelable ...
        & Metric
    %RELIEFF Summary of this class goes here
    %   Detailed explanation goes here
    
    properties ( SetAccess = protected )
        nK = 10
        % More parameters need consideration
    end
    
    methods % Set methods
        function [  ] = setNK( this, nK )
            if nargin == 1
                this.nK = 10;
            end
            if nargin == 2
                this.nK = nK;
            end
        end
    end
    
    methods
        function [ this ] =  ReliefF( name )
            if nargin == 0
                this.setName('relieff');
            end
            if nargin >= 1
                this.setName(name);
            end
        end
    end
    
    methods
        function [ result ] = apply( this, X2, Y2 )
            % Output
            %   result: zScore
            [~, result] = relieff(X2, Y2, this.nK);
            
            %%%TODO To optimize the following block
            while any(isnan(result))
                this.setNK(this.nK + ceil(0.05*size(X2, 1)));
                [~, result] = relieff(X2, Y2, this.nK);
            end
        end
    end
    
    methods ( Static = true )
        function [ result ] = calc( X, Y, nK )
            % Output
            %   result: zScore
            [~, result] = relieff(X, Y, this.nK);
            
            %%%TODO To optimize the following block
            while any(isnan(result))
                this.setNK(this.nK + ceil(0.05*size(X2, 1)));
                [~, result] = relieff(X2, Y2, this.nK);
            end
        end
    end
    
end

